/** 
 * 
 * Licensed under the MIT License and Apache License version 2.0
 * 
 * Copyright (c) 2011 Jazz Digital (http://www.jazz.etc.br) 
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * http://code.google.com/p/kinect-jazztures/
 * 
 * @author Valério Oliveira (valck) - http://www.valck.in
 * @author João Marquesini - http://www.markezine.me
 * @author Gabriel Tavares de Souza - http://www.gtsouza.com
 * 
 */
package jazztures.events{
	
	import flash.events.Event;
	
	import jazztures.geom.Point3D;
	
	/**
	 * 
	 * Creates an <code>GestureEvent</code> object to pass as a parameter to cursor events listeners.
	 * 
	 */
	public class GestureEvent extends Event{
	
		public static const TAP : String = "tap";
		public static const WAVE : String = "wave";
		public static const RAISE_HAND : String = "raise_hand";

		/**
		 * TODO
		 */
		public static const DOUBLE_TAP : String = "double_tap";

		/**
		 * TODO
		 */
		public static const HOLD : String = "hold";
		
		private var _position : Point3D = new Point3D();
		
		/**
		 * 
		 * Creates an <code>GestureEvent</code> object to pass as a parameter to cursor events listeners.
		 * 
		 * @param p_type The type of the event, accessible as GestureEvent.TAP, GestureEvent.WAVE and GestureEvent.RAISE_HAND.
		 * @param p_x The x axis coordinate of the gesture.
		 * @param p_y The y axis coordinate of the gesture.
		 * @param p_z The z axis coordinate of the gesture.
		 * @param p_bubbles Determines whether the GestureEvent object participates in the bubbling stage of the event flow. The default value is <code>false</code>.
		 * @param p_cancelable Determines whether the GestureEvent object can be canceled. The default values is <code>false</code>. 
		 * 
		 */
		public function GestureEvent(p_type:String, p_x:Number=NaN, p_y:Number=NaN, p_z:Number=NaN, p_bubbles:Boolean=true, p_cancelable:Boolean=false){
			_position.x = p_x;
			_position.y = p_y;
			_position.z = p_z;
			
			super(p_type, p_bubbles, p_cancelable);
		}
		
		
		/**
		 * 
		 * Indicates the x axis coordinate of the gesture.
		 * 
		 * @return <code>Number</code> 
		 * 
		 */
		public function get x():Number{
			return _position.x;
		}
		
		/**
		 * 
		 * Indicates the x axis coordinate of the gesture.  
		 * 
		 * @param p_value The <code>Number</code> to set.
		 * 
		 */
		public function set x(p_value:Number):void{
			_position.x = p_value;
		}
		
		/**
		 * 
		 * Indicates the y axis coordinate of the gesture.
		 * 
		 * @return <code>Number</code> 
		 * 
		 */
		public function get y():Number{
			return _position.y;
		}
		
		/**
		 * 
		 * Indicates the y axis coordinate of the gesture.
		 * 
		 * @param p_value The <code>Number</code> to set. 
		 * 
		 */
		public function set y(p_value:Number):void{
			_position.y = p_value;
		}
		
		/**
		 * 
		 * Indicates the z axis coordinate of the gesture.
		 * 
		 * @return <code>Number</code> 
		 * 
		 */
		public function get z():Number{
			return _position.z;
		}
		
		/**
		 * 
		 * Indicates the z axis coordinate of the gesture.
		 * 
		 * @param p_value The <code>Number</code> to set. 
		 * 
		 */
		public function set z(p_value:Number):void{
			_position.z = p_value;
		}
		
		/**
		 * 
		 * The new <code>GestureEvent</code> object includes all the properties of the original. 
		 * 
		 * @return <code>GestureEvent</code>
		 * 
		 */
		public override function clone():Event{
			return new GestureEvent(type, x, y, z, bubbles, cancelable);
		}
		
		/**
		 * 
		 * Returns a string containing all the properties of the <code>GestureEvent</code> object.
		 * 
		 * @return The string is in the following format: [GestureEvent type=value x=value y=value z=value bubbles=value cancelable=value]
		 * 
		 */
		public override function toString():String{
			return formatToString("GestureEvent", "type", "x", "y", "z", "bubbles", "cancelable");
		}
	}
}